import 'package:flutter/material.dart';

import 'package:provider/provider.dart';

class NormalModel {
  String val1;
  String val2;
  String val3;
  String val4;

  NormalModel(this.val1, this.val2, this.val3, this.val4);
}

class Normal extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    var value = context.select<NormalModel, String>((p) => p.val1);
    return Scaffold(
      appBar: AppBar(
        title: Text('Normal'),
      ),
      body: Center(
        child: Container(
          padding: EdgeInsets.all(20),
          decoration: BoxDecoration(
              shape: BoxShape.rectangle,
              border: new Border.all(color: Colors.black, width: 1)),
          child: Column(children: [
            Text(value),
            Widget1(),
          ]),
        ),
      ),
    );
  }
}

class Widget1 extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    var value = context.select<NormalModel, String>((p) => p.val2);
    return Container(
      padding: EdgeInsets.all(20),
      decoration: BoxDecoration(
          shape: BoxShape.rectangle,
          border: new Border.all(color: Colors.black, width: 1)),
      child: Column(children: [
        Text(value),
        Widget2(),
      ]),
    );
  }
}

class Widget2 extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    var value = context.select<NormalModel, String>((p) => p.val3);
    return Container(
      padding: EdgeInsets.all(20),
      decoration: BoxDecoration(
          shape: BoxShape.rectangle,
          border: new Border.all(color: Colors.black, width: 1)),
      child: Column(children: [
        Text('$value'),
        Widget3(),
      ]),
    );
  }
}

class Widget3 extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    var value = context.select<NormalModel, String>((p) => p.val4);
    return Container(
      padding: EdgeInsets.all(20),
      decoration: BoxDecoration(
          shape: BoxShape.rectangle,
          border: new Border.all(color: Colors.black, width: 1)),
      child: Column(children: [
        Text('$value'),
      ]),
    );
  }
}
